<template>
    <view class="content">
        <u-swiper :list="list" border-radius="0" mode="number" indicator-pos="bottomRight" height="750"></u-swiper>
		<view class="box">
			<view class="title">飞利浦（PHILIPS）咖啡机 意式全自动家用现磨咖啡机 欧洲原装进口</view>
			<view class="price">
				<image src="../../static/icon/point_1.png" class="point-1"></image>
				<view class="price-num">2699</view>
				<view class="line-price">￥69.00</view>
			</view>
		</view>
		<view>
		    <view class="detail">
				<view class="line2"></view>
				<view class="title2">宝贝详情</view>
				<view class="line2"></view>
			</view>
		    <!-- <u-parse :html="data.goods_detail"></u-parse> -->
		</view>
		
		<view class="footer" @click="doBuy">立即兑换</view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                list: [{image: '/static/del/14.jpg'},{image: '/static/del/14.jpg'}],
				id: '', //商品id
				data: {}, //商品信息
				isShow: false,
            };
        },
        onLoad(option) {
            if(option.id) {
                this.id = option.id;
            }
            // this.getData()
        },
        methods: {
			//立即兑换
			doBuy() {
				var goods = []
				var obj = {
					goods_id: this.id,//商品id
					goods_sku_id: this.skuID,//规格id		
					// goods_sku_name: this.skuName,//规格名称		
					goods_nums: this.numx,//商品数量	
				}
				goods.push(obj)
			    
				this.$ajax('confirmOrder', {
					userToken: this.$getSync('userToken'),
			        buyType: 1,
					buy_id: '' , //购物车id 购物车提交必填
					goods: goods, //[{"goods_id":1,"goods_sku_id":1,"goods_sku_name":'',"goods_nums":1}]
			        user_address_id: '',
				}).then(ret => {
					if (ret.status == 0) {
			            this.show = false;
			            this.$gTo('/pages/settlement/settle-point?data=' + JSON.stringify(ret.data))
					} else {
						this.$toast(ret.message)
					}
				})
			},     
			
			//获取商品详情
			getData() {
				this.$ajax('goodsinfo', {
					userToken: this.$getSync('userToken'),
					goods_id: this.id, //商品id
				}).then(ret => {
					if (ret.status == 0) {
			            this.data = ret.data;
						// 轮播图
						if (ret.data.goods_album_detail.length > 0) {
							ret.data.goods_album_detail.forEach((cur) => {
								this.list.push({
									image: cur.value
								})
							})
						}
						
						this.isShow = true;
					} else {
						this.$toast(ret.message);
					}
				});
			},
        }
    };
</script>

<style lang="scss">
	
    page{
        background-color: #f5f5f5;
    }
	.content{
		padding-bottom: 70px;
	}
	.box{
		background-color: #fff;
		padding: 30rpx 20rpx;
	}
	.title{
		font-size: 36rpx;
		font-weight: bold;
		white-space: pre-line;
		word-break: break-all;
	}
	.price{
		display: flex;
		justify-content: flex-start;
		align-items: center;
		padding-top: 16rpx;
	}
	.point-1{
		width: 21rpx;
		height: 24rpx;
		margin-right: 12rpx;
	}
	.price-num{
		font-size: 48rpx;
		color: #fb351f;
	}
	.line-price{
		font-size: 24rpx;
		color: #808080;
		text-decoration: line-through;
		padding-left: 25rpx;
	}
	
	
	
	.detail{
		display: flex;
		justify-content: center;
		align-items: center;
		padding: 25rpx 0;
	}
	.line2{
		width: 86rpx;
		height: 2rpx;
		background-color: #e5e5e5;
	}
	.title2{
	    font-size: 24rpx;
		color: #5c5c5c;
		padding: 0 20rpx;
	}
	
	
	.footer{
		width: 100%;
		height: 100rpx;
		background-color: #2658aa;
		display: flex;
		justify-content: center;
		align-items: center;
		position: fixed;
		bottom: 0;
		left: 0;
		font-size: 32rpx;
		color: #fff;
	}
	
	

</style>
